﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace SolutionCrapFinder
{
    class SolutionFile
    {
        enum SolutionFileFeatures
        {
            Idle = 0,
            Skipped,
            Parsed,
        }
        // members
        string m_fileName;
        int m_features = 0;
        List<SolutionFile> m_filesThatUseIt = new List<SolutionFile>();
        List<ProjectInfo> m_projectsThatUseIt = new List<ProjectInfo>();

        // construct/destruct
        public SolutionFile(string name)
        {
            m_fileName = name;
        }

        // public methods

        public string FileName
        {
            get { return m_fileName; }
        }

        public void AddFileThatUseIt(SolutionFile slnFile)
        {
            if (slnFile == this)
                return;

            foreach (SolutionFile f in m_filesThatUseIt)
            {
                if (f == slnFile)
                    return;
            }

            m_filesThatUseIt.Add(slnFile);
        }

        public void AddProjectThatUseIt(ProjectInfo proj)
        {
            foreach (ProjectInfo projInfo in m_projectsThatUseIt)
            {
                if (proj == projInfo)
                    return;
            }

            m_projectsThatUseIt.Add(proj);
        }

        public void SetParsed()
        {
            m_features &= (int)SolutionFileFeatures.Parsed;
        }

        public void SetSkipped()
        {
            m_features &= (int)SolutionFileFeatures.Skipped;
        }

        // private methods
    }
}
